# Maintainer: Sarah Ottinger <schalaalexiazeal@gmail.com>

_realname=numba
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=0.61.2
pkgrel=1
pkgdesc='NumPy aware dynamic Python compiler using LLVM (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://numba.pydata.org/"
msys2_repository_url="https://github.com/numba/numba"
msys2_references=(
  'purl: pkg:pypi/numba'
)
license=('spdx:BSD-2-Clause')
depends=(
  "${MINGW_PACKAGE_PREFIX}-python"
  "${MINGW_PACKAGE_PREFIX}-python-llvmlite"
  "${MINGW_PACKAGE_PREFIX}-python-numpy"
  "${MINGW_PACKAGE_PREFIX}-gcc-libs"
  "${MINGW_PACKAGE_PREFIX}-omp"
)
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools"
             "${MINGW_PACKAGE_PREFIX}-cc")
optdepends=("${MINGW_PACKAGE_PREFIX}-python-scipy")
options=('!emptydirs' '!strip')
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('8750ee147940a6637b80ecf7f95062185ad8726c8c28a2295b8ec1160a196f7d')

build() {
  cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"

  NUMBA_DISABLE_TBB=1 python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "python-build-${MSYSTEM}"
  MSYS2_ARG_CONV_EXCL="--prefix=" \
    python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
